package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Charge;
import com.hl.sfzy.service.ChargeService;
import com.hl.sfzy.mapper.ChargeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargeServiceImpl implements ChargeService {
    @Autowired
    private ChargeMapper chargeMapper;
    @Override
    public long deleteById(long id) {
        return chargeMapper.deleteById(id);
    }

    @Override
    public long update(Charge charge) {
        return chargeMapper.update(charge);
    }

    @Override
    public long insert(Charge charge) {
        return chargeMapper.insert(charge);
    }

    @Override
    public List<Charge> selectAll() {
        return chargeMapper.selectAll();
    }

    @Override
    public List<Charge> selectByPrimaryKey(long id) {
        return chargeMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo<Charge> findByPage(int pageNum, int pageSize, Charge charge) {
        PageHelper.startPage(pageNum,pageSize);
        List<Charge> charges = chargeMapper.findByPage(pageNum,pageSize,charge);
        PageInfo<Charge> pageInfo = new PageInfo<>(charges);
        return pageInfo;
    }
}
